package org.example.text03;

/**
 * 长矛实现类，实现战士武器接口
 */

public class Pike implements Weapon{
    private String name;
    private Soldier soldier;//武器使用者

    public Pike(){

    }
    public Pike(String name) {
        this.name = name;
    }

    public Pike(String name, Soldier soldier) {
        this.name = name;
        this.soldier = soldier;
    }

    @Override
    public int fire() {
        if (name.equals(soldier.getName())){
            return 100;
        }else {
            return 25;
        }

    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Soldier getSoldier() {
        return soldier;
    }

    public void setSoldier(Soldier soldier) {
        this.soldier = soldier;
    }
}
